//
//  SaSystemApplicationUtils.m
//  saas
//
//  Created by Nick Wong on 12/27/19.
//  Copyright © 2019 fangmao. All rights reserved.
//

#import "SaSystemApplicationUtils.h"
#import <UIKit/UIKit.h>
#import <Photos/Photos.h>
#import "SaProgressHUD.h"
static NSDictionary *appInfo ;
void callPhoneWithPhoneNum(NSString *phone){
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", phone]] options:nil completionHandler:^(BOOL success) {
        
    }];
}
NSError *saveImageToPhotoLibrary(UIImage *image){
    NSError *error = nil;
    [[PHPhotoLibrary sharedPhotoLibrary] performChangesAndWait:^{
        [PHAssetChangeRequest creationRequestForAssetFromImage:image];
        if(!error)[SaProgressHUD showSucess:@"保存成功"];
    } error:&error];
    
    return error;
}
NSString *getAppName(){
    if (!appInfo)appInfo = [[NSBundle mainBundle] infoDictionary];
    return [appInfo objectForKey:@"CFBundleDisplayName"];
}
NSString *getAppVersion(){
    if (!appInfo)appInfo = [[NSBundle mainBundle] infoDictionary];
    return [appInfo objectForKey:@"CFBundleShortVersionString"];
}


